<template>
	<view>
		<view class="avther-main" @tap.stop="avaterChange">
			<image v-if="data.avatar != ''" class="avther-image" :src="data.avatar" mode=""></image>
			<text v-else class="icon icon-paizhao"></text>
		</view>
		
		<view class="register-btn1" @tap="next" :style="'background-image: url('+$c.config.media+'mini/common/jiesuo.png);'">
			继续
		</view>
	</view>
</template>

<script>
    export default {
	props:{
		parent: { type: Object },
		data:{type:Object,default:{}}
	},
        data () {
            return {
                $c: this.$c,
            }
        },
		created() {
			// #ifndef MP
			this.$parent = this.parent;
			// #endif
		},
        methods: {
			avaterChange(){
			    this.$c.uploadOss('spu_detail', '', '', 1, res => {
			        if (res.url == 0 || res.url == undefined || res.url == '') {
			            this.$c.show('图片上传失败');
			            return;
			        }
			        this.$parent.dataObj.avatar = res.url;
			    })
			},
		next(){
			if(!this.data.avatar){
				this.$c.show('请上传头像')
				return
			}
			this.$parent.current = 8
		}
		}
    }
</script>

<style lang="scss">
.avther-main{
	width: 276rpx;
	height: 276rpx;
	border: 4rpx solid #8F7DFA;
	background-color: #221F30;
	border-radius: 50%;
	text-align: center;
	line-height: 276rpx;
	margin: 80rpx auto 120rpx;
	.icon-paizhao{
		font-size: 80rpx;
		color: #4B436C;
	}
}	.avther-image{
	width: 276rpx;
	height: 276rpx;
	border-radius: 50%;
}
	.register-btn1{
		width: 694rpx;
		height: 100rpx;
		display: block;
		margin: 0 auto;
		background-size: 100% 100%;
		text-align: center;
		line-height: 100rpx;
		color: #FFFFFF;
		margin-top: 80rpx;
	}
</style>
